﻿// 1.1.7.13. Write a program, which creates a rectangular array with size of n by m elements. The dimensions and the
// elements should be read from the console. Find a platform with size of (3, 3) with a maximal sum.

using System;

class PlatformOf3x3ElementsWithAMaxSum
{
    static void Main()
    {
        int x = int.Parse(Console.ReadLine());
        int y = int.Parse(Console.ReadLine());
        int[,] matrice = new int[y, x];
        for (int row = 0; row < y; row++)
        {
            for (int col = 0; col < x; col++)
            {
                matrice[y, x] = int.Parse(Console.ReadLine());
            }
        }
        int bestSum = 0;
        int beginXplatform = 0;
        int beginYplatform = 0;
        for (int row = 0; row < matrice.GetLength(0) - 2; row++)
        {
            int currentSum = 0;
            for (int col = 0; col < matrice.GetLength(1) - 2; col++)
            {
                currentSum += matrice[row, col];
                currentSum += matrice[row + 1, col];
                currentSum += matrice[row + 2, col];
                currentSum += matrice[row, col + 1];
                currentSum += matrice[row, col + 2];
                currentSum += matrice[row + 1, col + 1];
                currentSum += matrice[row + 1, col + 2];
                currentSum += matrice[row + 2, col + 1];
                currentSum += matrice[row + 2, col + 2];
                if (currentSum > bestSum)
                {
                    bestSum = currentSum;
                    beginXplatform = col;
                    beginYplatform = row;
                }
            }
        }

    }
}